package cn.dujc.superkid.toolbar;

import android.support.v7.widget.Toolbar;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.dujc.core.toolbar.IToolbar;
import cn.dujc.superkid.R;
import cn.dujc.superkid.activities.MainActivity;

/**
 * @author du
 * date 2018/7/28 下午3:42
 */
public class ToolbarKeeper {

    @IToolbar(exclude = MainActivity.class)
    public Toolbar normalToolbar(ViewGroup parent){
        return (Toolbar) LayoutInflater.from(parent.getContext()).inflate(R.layout.toolbar_normal, parent, false);
    }

    /*@IToolbar(include = MainActivity.class)
    public Toolbar mainToolbar(ViewGroup parent){
        return (Toolbar) LayoutInflater.from(parent.getContext()).inflate(R.layout.toolbar_main, parent, false);
    }*/

    public static Toolbar initFragmentToolbar(ViewGroup parent, String title){
        final Toolbar toolbar = (Toolbar) LayoutInflater.from(parent.getContext()).inflate(R.layout.toolbar_main_fragment, parent, false);
        //toolbar.findViewById(R.id.toolbar_back_id).setVisibility(View.INVISIBLE);
        ((TextView)toolbar.findViewById(R.id.toolbar_title_id)).setText(title);
        return toolbar;
    }
}
